﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.snowflake
{
	// Token: 0x020000F4 RID: 244
	public class TCreateStreamStmt : TCustomSqlStatement
	{
		// Token: 0x1700016F RID: 367
		// (get) Token: 0x06000835 RID: 2101 RVA: 0x00301B49 File Offset: 0x002FFD49
		// (set) Token: 0x06000836 RID: 2102 RVA: 0x00301B51 File Offset: 0x002FFD51
		public TObjectName TableName
		{
			get
			{
				return this._tableName;
			}
			set
			{
				this._tableName = value;
			}
		}

		// Token: 0x17000170 RID: 368
		// (get) Token: 0x06000837 RID: 2103 RVA: 0x00301B5A File Offset: 0x002FFD5A
		// (set) Token: 0x06000838 RID: 2104 RVA: 0x00301B62 File Offset: 0x002FFD62
		public TObjectName StreamName
		{
			get
			{
				return this._streamName;
			}
			set
			{
				this._streamName = value;
			}
		}

		// Token: 0x06000839 RID: 2105 RVA: 0x00301B6B File Offset: 0x002FFD6B
		public TCreateStreamStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstCreateStream;
		}

		// Token: 0x0600083A RID: 2106 RVA: 0x00301B80 File Offset: 0x002FFD80
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TDummy tdummy = (TDummy)this.rootNode;
			this._streamName = (TObjectName)tdummy.node1;
			TSourceTokenList container = tdummy.startToken.container;
			bool flag = false;
			for (int i = 0; i < container.size(); i++)
			{
				TSourceToken tsourceToken = container.get(i);
				if (!tsourceToken.isnonsolidtoken())
				{
					if (tsourceToken.tokencode == 308)
					{
						flag = true;
					}
					else if (flag)
					{
						this._tableName = new TNodeFactory().createObjectName(null, null, tsourceToken);
						this._tableName.DbObjectType = EDbObjectType.table;
						break;
					}
				}
			}
			return 0;
		}

		// Token: 0x0600083B RID: 2107 RVA: 0x00301C29 File Offset: 0x002FFE29
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x0600083C RID: 2108 RVA: 0x00301C39 File Offset: 0x002FFE39
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001205 RID: 4613
		private TObjectName _tableName;

		// Token: 0x04001206 RID: 4614
		private TObjectName _streamName;
	}
}
